<!--
 * @Author: 王明明834578987 10266004+wang-mingming-834578987@user.noreply.gitee.com
 * @Date: 2024-08-29 10:59:23
 * @LastEditors: 王明明834578987 10266004+wang-mingming-834578987@user.noreply.gitee.com
 * @LastEditTime: 2024-09-11 14:59:51
 * @FilePath: \ft-apply-admin\src\views\applicationDetails\RTComponent\InterviewTache\Train\TrainComponent\TrainMailSend.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="btns">
    <Button v-auth="'affirmArriveTrainingAccept'" color="success" @click="arrival">确认到培</Button>
    <Button v-auth="'arriveTrainingWaive'" color="warning" @click="surrender">放弃</Button>
    <Button v-auth="'editTrainingTime'" color="#5882d1" @click="changeDate">改期</Button>
  </div>
</template>

<script setup lang='ts'>
import { Button } from "@/components/Button";
import { message } from "ant-design-vue";
import { trainingArrive } from "@/api/application-details/index.ts";
import { comStores } from '@/store/common/comStore';
const store = comStores()
const { userName } = store.userInFor

const arrival = async () => {
  const { resumeId, processId } = store.currentResume;
  console.log('确认到培 arrival')
  const param = {
    resumeId: resumeId,
    processId: processId,
    result: "通过",
    trainingId: 0,
    operator: userName
  }
  const data = await trainingArrive(param)
  if (data && data.code == '10000') {
    message.success("操作成功");
    store.getResumeInfo(resumeId)
  } else {
    message.error(data.msg)
  }
}
const emits = defineEmits(['surrender', 'changeDate'])
const surrender = () => {
  console.log('surrender')
  emits('surrender', '预约邮件已发送')
}
const changeDate = () => {
  console.log('changeDate 改期');
  emits('changeDate', '预约邮件已发送')
}


</script>
<style lang="less" scoped>
.btns {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
</style>